package org.abacus.abs.reflect;

import java.lang.reflect.Type;
import java.util.List;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) {
		TypeHelper typeHelper = new TypeHelper();
		System.out.println("Hello World!");
		try {
			System.out.println(GenericType.class.getDeclaredField("names").getGenericType().getClass().getName());
			Type typeOfObject = GenericType.class.getDeclaredField("names").getGenericType();
			System.out.println(typeHelper.getTypes(typeOfObject)[0]);
			Type rawType = typeHelper.getRawType(typeOfObject);
			System.out.println(rawType == List.class);
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (NoSuchFieldException e) {
			e.printStackTrace();
		}

		try {
			System.out.println(GenericType.class.getDeclaredMethod("getValues").getGenericReturnType().getClass().getName());
			Type typeOfObject = GenericType.class.getDeclaredMethod("getValues").getGenericReturnType();
			System.out.println(typeHelper.getTypes(typeOfObject)[0]);
			Type rawType = typeHelper.getRawType(typeOfObject);
			System.out.println(rawType == List.class);
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			e.printStackTrace();
		}
	}
}
